﻿package mortal.game.view.pack
{
    import com.mui.controls.*;
    import com.mui.display.*;
    import com.mui.utils.*;
    import fl.controls.listClasses.*;
    import mortal.component.gconst.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.item.*;

    public class PackCellRenderer extends GCellRenderer
    {
        private var _packItem:PackItem;

        public function PackCellRenderer()
        {
            setSize(40, 40);
            return;
        }// end function

        override protected function initSkin() : void
        {
            var _loc_1:* = UICompomentPool.getUICompoment(GBitmap) as GBitmap;
            var _loc_2:* = ResourceConst.getScaleBitmap(ImagesConst.selectedBg);
            this.setStyle("downSkin", _loc_2);
            this.setStyle("overSkin", _loc_2);
            this.setStyle("upSkin", _loc_1);
            this.setStyle("selectedDownSkin", _loc_2);
            this.setStyle("selectedOverSkin", _loc_2);
            this.setStyle("selectedUpSkin", _loc_2);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._packItem = UICompomentPool.getUICompoment(PackItem);
            this._packItem.setItemStyle(ItemStyleConst.Small, ImagesConst.PackItemBg, 2, 2);
            this._packItem.x = 3;
            this._packItem.y = 3;
            this.addChild(this._packItem);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._packItem.dispose(param1);
            this._packItem = null;
            super.disposeImpl(param1);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._packItem.data = param1;
            return;
        }// end function

        override public function set listData(param1:ListData) : void
        {
            this._packItem.pos = param1.index + 1;
            super.listData = param1;
            return;
        }// end function

    }
}
